<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    template="/template.xhtml"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="content">
		<style> .ui-datatable input.ui-column-filter { display: inline-block; padding: 0; margin-left: 10px; } </style>
		<h1>Sprint Backlog <small>#{bundle['sprint.list.project']}</small></h1>
        <div class="row">
            <div class="span8" style="position: relative">
				<h:form style="position: absolute; right: 0px;top: -34px;">
					<h:commandButton  action="#{sprintManager.create}" value="#{bundle['sprint.new']}" styleClass="btn btn-success" />
				</h:form>
				<h:form>                    
					<p:dataTable value="#{sprintManager.sprints}" var="sprint" paginator="true" paginatorPosition="bottom" rows="14" emptyMessage="No hay ningun sprint asociado al proyecto actual">
						<p:column>
							<f:facet name="header">
								<h:outputText value="id" />
							</f:facet>
							<h:outputText value="#{sprint.id}" />
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="#{bundle['nav.task']}"/>
							</f:facet>
							<h:outputText value="#{sprint.tasks.size()}"/>
						</p:column>
						<p:column sortBy="#{sprint.created}">
							<f:facet name="header">
								<h:outputText value="#{bundle['sprint.created']}" />
							</f:facet>
							<h:outputText value="#{sprint.created}" >
								<f:convertDateTime pattern="d/M/yyyy"/>
							</h:outputText>

						</p:column>
						<p:column sortBy="#{sprint.beginDate}">
							<f:facet name="header">
								<h:outputText value="#{bundle['sprint.start']}" />
							</f:facet>
							<h:outputText value="#{sprint.beginDate}" >
								<f:convertDateTime pattern="d/M/yyyy"/>
							</h:outputText>
						</p:column>
						<p:column sortBy="#{sprint.endDate}">
							<f:facet name="header">
								<h:outputText value="#{bundle['sprint.finish']}" />
							</f:facet>
							<h:outputText value="#{sprint.endDate}" >
								<f:convertDateTime pattern="d/M/yyyy"/>
							</h:outputText>
						</p:column>
						<p:column filterBy="#{sprint.summary}" sortBy="#{sprint.summary}" >
							<f:facet name="header">
								<h:outputText value="#{bundle['sprint.summary']}" />
							</f:facet>
							<h:commandLink value="#{sprint.summary}" action="#{sprintManager.edit}" />
						</p:column>
					</p:dataTable>
				</h:form>
			</div>

			<div class="span4">
                <h3>#{bundle['sprint.text.statis']}</h3>
                <p>#{bundle['sprint.text.graf1']} <code> #{projectManager.currentProject.name}</code></p>
                <h:form>
                    <c:choose>
                        <c:when test="#{statisticsBean.maxValueBarModel>0}">
                            <p:barChart id="basic" value="#{statisticsBean.storyPointBarModel}" legendPosition="ne"  
										title="#{bundle['sprint.graf']}" min="0"  style="width:300px;height:300px;margin-top:20px;"/>
                        </c:when>
                        <c:otherwise>
                            <h:outputLabel value="#{bundle['sprint.graf.noinfo']}"  style="color:#da4f49"/>
                        </c:otherwise>
                    </c:choose>
                </h:form>
            </div>
        </div>
    </ui:define>
</ui:composition>
